//
//  Date+Format.swift
//  Utility
//
//  Created by yuhus on 2023/11/2.
//

import Foundation

public extension Date {
  func about5minRemaining(from ti: TimeInterval) -> String? {
    let formatter = DateComponentsFormatter()
    formatter.unitsStyle = .full
    formatter.includesApproximationPhrase = true
    formatter.includesTimeRemainingPhrase = true
    formatter.allowedUnits = [.minute]
    
    // Use the configured formatter to generate the string.
    let outputString = formatter.string(from: ti)
    return outputString
  }
}
